#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QMessageBox>
#include <QDebug>
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_pushButton_clicked()
{
    QMessageBox* messageBox = new QMessageBox(this);

    messageBox->setIcon(QMessageBox::Warning);
    messageBox->setStyleSheet(QString("QLabel{")+
                         "min-width: 400px;"+
                         "min-height: 300px; "+
                         "}");
    messageBox->setStandardButtons(QMessageBox::Ok|QMessageBox::No);
    //messageBox->setBaseSize(400,300);
    //messageBox->setFixedSize(400,300);
    //messageBox->setText("请输文本");
    //messageBox->resize(800,600);
   // messageBox->setGeometry(0,0,400,300);
//    QPushButton* button = new QPushButton(messageBox);
//    button->setText("按钮");
//    messageBox->addButton(button,QMessageBox::AcceptRole);
    //messageBox->show();
    int result = messageBox->exec();
    if(result==QMessageBox::Ok)
        qDebug()<<"Ok";
    else if(result ==QMessageBox::No)
        qDebug()<<"No";
    messageBox->setAttribute(Qt::WA_DeleteOnClose);

}
